<?php

namespace App\Kuafu\Activity\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;

class ActivityCouponMappingModel extends BaseModel
{
    use KfSoftDeletes;

    protected $connection = 'mysql';
    protected $table      = 'activity_coupon_mappings';
    protected $primaryKey = 'id';

    /**
     * 根据优惠券id集合获取活动id集合
     * @param $couponIds
     * @return \Illuminate\Database\Eloquent\Builder[]|\Illuminate\Database\Eloquent\Collection
     */
    public static function getActivityIdsByCouponIds($couponIds)
    {
        return self::query()
                   ->whereIn('couponId', $couponIds)
                   ->select(['activityId'])
                   ->get();
    }
}
